using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerPickUp : MonoBehaviour
{
    [SerializeField]
    private LayerMask pickLayMask;

    [SerializeField,Range(0.1f, 2f)]
    private float pickUpRadius;

    public Dictionary<string, int> playerItemsStore = new()
    {
        { "Key", 0 },       // 过关钥匙
    };

    private void Update()
    {
        var obj = Physics2D.OverlapCircle(transform.position, pickUpRadius, pickLayMask);
        if (!obj)
        {
            return;
        }

        if (playerItemsStore.ContainsKey(obj.transform.name))
        {
            playerItemsStore[obj.transform.name]++;
            Destroy(obj.transform.gameObject);
        }
    }
}
